import request from '_r/request'

const api_name = 'login'

// 登录方法
export function login(username, password, verifyCode, verifyCodeUUID) {
	const data = {
		username,
		password,
		verifyCode,
		verifyCodeUUID
	}
	return request({
		url: `${api_name}/login`,
		method: 'post',
		headers: {
			isToken: false
		},
		data
	})
}

// 退出方法
export function logout() {
	return request({
		url: `${api_name}/logout`,
		method: 'post',
	})
}

// 获取登陆方式
export function getCaptchaMode() {
	return request({
		url: `${api_name}/captchaMode`,
		method: 'get',
		headers: {
			isToken: false
		},
	})
}

// 获取验证码
export function getCodeImg() {
	return request({
		url: `${api_name}/captcha`,
		method: 'get',
		timeout: 20000,
		headers: {
			isToken: false
		},
	})
}

// 注册
export function register(data) {
	return request({
		url: `${api_name}/register`,
		method: `post`,
		data
	})
}
